Function

Parameters

Description

Usage

CreatePlayerShip()

sShipClass - class of ship (a ship file)

pSet - the set to use

pcName - name for the player

sWaypoint - placement at which to place the player

bUnloadShip - unload all torps? defaults to zero

Creates the player's ship in the specified set, at the specified placement.

pPlayer = MissionLib.CreatePlayerShip("Galaxy", pSet, "player", "Player Start")

SetupSpaceSet()

pcSetName - module name for set to create

Creates and initializes the set.

pSet = MissionLib.SetupSpaceSet("Systems.Starbase12.Starbase12")

SetupBridgeSet()

pcSetName - module name for set to create

pcModelName - name of model for the bridge

fX, fY, fZ - translate for the camera

fMX, fMY, fMZ - translate for the model

Creates and initializes a set for another ship's bridge. (not the player)

pCardSet = MissionLib.SetupBridgeSet("CardSet", "data/Models/Sets/Cardassian/cardbridge.nif", -30, 65, -1.55)

SetupCharacter()

pcCharacterPath - path of the character

pcSetName - name of the set

Creates and sets up a character on a bridge set.

pLiu = MissionLib.SetupCharacter("Bridge.Characters.Admiral_Liu", "StarbaseSet", 0, 0, 5)

CreateTimer()

eType - event type

sFunctionHandler - function to run

fStart - start time for timer

fDelay - delay between firings

fDuration - how long timer fires

bEpisode - attach to episode instead of mission. default 0

bRealTime - use real time instead of game time. default 0

This is a simplified interface for creating a mission timer. You specify an event type, the function to run, and timer parameters, and it will create a handler for the mission to deal with that timer.

MissionLib.CreateTimer(ET_MY_EVENT_TYPE, __name__ + ".TimerHandler", App.g_kUtopiaModule.GetGameTime() + 5.0, 5.0, 5.0)

DeleteAllMissionTimers()

none

Deletes all mission-level timers created by CreateTimer()

MissionLib.DeleteAllMissionTimers()

DeleteAllEpisodeTimers()

none

Deletes all episode-level timers created by CreateTimer()

MissionLib.DeleteAllEpisodeTimers()

GetShip()

pcShipName - name of the ship

pSet - set to search

bAnySet - search all sets? defaults to zero

Returns the ship with the specified name.

pShip = MissionLib.GetShip("Galor 1", None, 1)

IsInSameSet()

pcShip - name of ship to check

Checks if the ship is in the same set as the player.

if MissionLib.IsInSameSet("Galor 1"):

ProximityCheck()

pMainObj - object the check is centered around

fRadius - radius to check. Negative to check if inside, positive to check if outside

pObjList - Python list of objects that can trigger the proximity

pSet - the set

eEventType - event type for proximity

Creates a proximity check for the specified object. If an object crosses the specified boundary, an event with the specified type will be sent.

MissionLib.ProximityCheck(pPlayer, 500.0, [pGalor1, pGalor2], pPlayer.GetContainingSet(), ET_GALOR_ATTACK)

IgnoreEvent()

pObject - object for event

pEvent - the event

This is useful to attach as an instance handler on an object to make it ignore a certain event type.

pObject.AddPythonFuncHandlerForInstance(ET_WHATEVER, "MissionLib.IgnoreEvent")

IgnoreEventOnce()

pObject - object for event

pEvent - the event

Like IgnoreEvent(), but only ignores once.

pObject.AddPythonFuncHandlerForInstance(ET_WHATEVER, "MissionLib.IgnoreEventOnce")

CallWaiting()

bOn - turn on and off

This function turns on and off "Call Waiting", which disables menu items associated with contacting other ships

# Turn on call waiting in a sequence

pAction = App.TGScriptAction_Create("MissionLib", "CallWaiting", 1)

 

# Turn off call waiting

MissionLib.CallWaiting(None, 0)

ViewscreenOn()

pAction - for TGScriptActions

pcLookAtSet - the set to view

pcName - who to look at

fMinStatic - minimum static value

fMaxStatic - maximum static value

bDropMenus - do we drop menus?

This function turns on the viewscreen to look at another set.  You can turn static on if desired, and also drop character menus and have the camera look forward.  If you specify None as pcName, it will keep the visibility of the characters as-is, not hiding anyone, and not unhiding anyone.

# Turn the viewscreen on in a sequence

pAction = App.TGScriptAction_Create("MissionLib", "ViewscreenOn", "Starbase", "Liu")

 

# Turn it on directly

MissionLib.ViewscreenOn(None, "EBridgeSet", "Picard", 0.1, 0.5, 0)

 

# Show everyone on the set

MissionLib.ViewscreenOn(None, "WillisSet", None, 0.1, 0.5, 0)

 

ViewscreenOff()

pAction - for TGScriptActions

iPlaySound - whether or not to play the ViewOff sound. Defaults to 1.

Changes the viewscreen so it's looking at the player's set.

# Called in a sequence.

pAction = App.TGScriptAction_Create("MissionLib", "ViewscreenOff")

 

# Called directly.

MissionLib.ViewscreenOff(None)

SetupExtra()

pcBridge - name of the set to add to

pcName - name of the extra

pcLocation - where to place them

pcHeadNIF, pcBodyNIF - models

pcHeadTexture - texture of head

pcBodyTexture - texture of body

This function creates a character to place on a bridge, to make it look more lifelike

# Add a Kessok as a guest to our D Bridge

MissionLib.SetupExtra("bridge", "Kessok", "DBGuest", "HeadKessok/kessok_head.nif", "BodyKessok/BodyKessok.nif", "HeadKessok/kessok_head.tga", "BodyKessok/kessok_body.tga")

SetSpeakingVolume()

pAction - for TGScriptActions

iType - type of line to set volume on

fVolume - 0 = mute, 1 = normal

This function tells the characters to soften certain line types, if needed

CSP_SPONTANEOUS

CSP_NORMAL

CSP_MISSION_CRITICAL

# Mute "spontaneous noises"

MissionLib.SetSpeakingVolume(None, App.CSP_SPONTANEOUS, 0.0)

 

# Soften "normal noises" like "Yes, Sir" lines

pAction = App.TGScriptAction_Create("MissionLib", "SetSpeakingVolume", App.CSP_NORMAL, 0.5)

PreloadSequenceLines()

None

This searches through the sequence that contains it and preloads any voice lines into memory, so they don’t hitch the framerate when that line starts.

# Create a sequence that will contain some dialogue.

pSequence = App.TGSequence_Create()

# First thing in the sequence, setup an action to preload the voice lines.

pSequence.AddAction( App.TGScriptAction_Create("MissionLib", "PreloadSequenceLines") )

 

# Add some voice lines…

pSequence.AddAction(App.CharacterAction_Create(g_pFelix, App.CharacterAction.AT_SPEAK_LINE_NO_FLAP_LIPS, "E6Intro1", None, 0, g_pMissionDatabase)

 

pSequence.AppendAction(App.CharacterAction_Create(g_pFelix, App.CharacterAction.AT_SPEAK_LINE_NO_FLAP_LIPS, "E6Intro2", None, 0, g_pMissionDatabase)

 

# Play the sequence.

pSequence.Play()

FadeOut

pAction – For TGScriptActions

fFadeTime – Time (in seconds) over which to fade to black.  Defaults to 1.5 seconds

Fade to black

# Add a fade out to a sequence, using the default fade-out time.

pSequence.AppendAction( App.TGScriptAction_Create(“MissionLib”, “FadeOut”) )

FadeIn

pAction – For TGScriptActions

fFadeTime – Time (in seconds) over which to fade back up to normal.  Defaults to 1.5 seconds.

Fade from black back to normal

# Add a fade in after the fade out…  Take 5 seconds to fade in, though.

pSequence.AppendAction( App.TGScriptAction_Create(“MissionLib”, “FadeIn”, 5.0) )

StartCutscene

pAction - For TGScriptActions

fTimeToComeIn - Time (in seconds) to bring cutscene bars in, defaults to 1 sec.

fCoveredArea - How much of the screen is covered by cutscene bars defaults to 0.125.

bHideReticle - Do we want to hide the target reticle, defaults to true

bSilenceCallOuts - Do we want the crew call outs silenced, defaults to true.

Brings down the cutscene bars and takes control away from the player.

Normally called as a script action in a TGSequence.

 

# Start a standard cutscene in a sequence

pSequence.AppendAction( App.TGScriptAction_Create(“MissionLib”, “StartCutscene”) )

EndCutscene

pAction - For TGScriptActions.

fTimeToLeave - Time (in seconds) to bring the cutscene bars up, defaults to 1.0 sec.

Brings up the cutscene bars and returns control to the player.  Also returns the volume of the crew call-outs to the default level.

Normally called as script action in a TGSequence.

 

# End a cutscene in a TGSequence.

pSequence.AppendAction( App.TGScriptAction_Create(“MissionLib”, “EndCutscene”) )

TextBanner

pAction - For TGScriptActions.

kTextString - String to display.

fX, fY - position of the banner

fDuration - Time (in seconds) the banner remains up, defaults to .

iSize - Font size to use, defaults to 16.

bHCentered - To center banner horizontally or no, defaults to true.

bVCentered - To center banner vertically or not, defaults to false..

Displays a passed in string as a text banner on the screen.  Normally called as a script action.

# Put a text banner across the top of the screen after getting

# the string to display from a localized TGL with a 10 sec duration.

kSting = pTGLDatabase.GetString("BannerText")

 

pSequence.AppendAction( App.TGScriptAction_Create(“MissionLib”, “TextBanner”, kString, 0, 0.05, 10) )

AddNavPoints()

sSet - name of set

*lsNavPointNames - list of names of placements to make nav points

Changes the specified placements to be nav points, which will then show up in the helm menu.

MissionLib.AddNavPoints("Biranu2", ["Placement 1", "Placement 2"])

RemoveNavPoints()

same as AddNavPoints()

Changes the specified placements to not be nav points. Removes them from the helm menu.

MissionLib.RemoveNavPoints("Biranu2", ["Placement 1", "Placement 2"])

AddCommandableShip()

sShipName - name of ship

lsCommands - list of commands. optional -- if not included, will enable all commands

Makes a ship commandable by the player (using the hail menu). Enables the specified orders (or all of them, if none were specified). Orders are "AttackTarget", "DisableTarget", "DefendTarget", "HelpMe".

# Only one order

MissionLib.AddCommandableShip("Geronimo", "HelpMe")

 

# All orders

MissionLib.AddCommandableShip("Enterprise")

RemoveCommandableShip()

sShipName - name of ship

Makes the ship no longer commandable by the player.

MissionLib.RemoveCommandableShip("Enterprise")

RemoveAllCommandableShips()

 

Removes all ships from the list that can be commanded by the player.

MissionLib.RemoveAllCommandableShips()

AddGoal()

pcGoalStringID - list of goal string IDs to add to first officer's menu

Used to add objectives to the first officer's menu.

MissionLib.AddGoal("Goal1", "Goal2", "Goal3")

AddGoalAction()

pAction - for TGScriptActions

pcGoalStringID - goal to add

Like AddGoal(), but called as a script action.

pAction = App.TGScriptAction_Create("MissionLib", "AddGoalAction", "Goal1")

RemoveGoal()

pcGoalStringID - goal to disable

Disables the goal in the first officer's menu.

MissionLib.RemoveGoal("Goal1")

RemoveGoalAction()

pAction - for TGScriptActions

pcGoalStringID - goal to disable

Like RemoveGoal(), but called as a script action.

pAction = App.TGScriptAction_Create("MissionLib", "RemoveGoalAction", "Goal1")

DeleteGoal()

pcGoalStringID - goal to delete

Deletes the goal from the first officer's menu.

MissionLib.DeleteGoal("Goal2")

DeleteAllGoals()

 

Deletes all goals from the first officer's menu.

MissionLib.DeleteAllGoals()

GameOver()

pAction - for TGScriptActions

pSequence - alternate "you lose" sequence to use

Does a "game over" -- tells the player they failed, fades to black, brings up game over screen. Can use provided sequence instead of default "you failed" message.

pAction = App.TGScriptAction_Create("MissionLib", "GameOver")

LookForward()

pAction - for TGScriptActions

bWaitForSweep - wait for sweep to complete before completing action

Makes the player's bridge camera look forward, at the viewscreen.

pAction = App.TGScriptAction_Create("MissionLib", "LookForward", 1)

GetDistance()

pObj1, pObj2 - objects to compare

Returns the straight-line distance between the two objects.

fDist = MissionLib.GetDistance(pObj1, pObj2)

CreateCompletionEvent

pAction - For TGScriptActions.

 

Creates and returns a ET_ACTION_COMPLETED TGObjPtr Event for given action.

def WhatuSay(pAction):

# Delay main sequence until action has been completed.

pSeq = App.TGSequence_Create()

pAction = App.CharacterAction_Create(pFelix, App.CharacterAction.AT_MOVE, "L1")

pSeq.AppendAction(pAction)

pSeq.AddCompletedEvent(MissionLib.CreateCompletionEvent(pAction))

pSeq.Play()

 

# Function returns 1

return 1